#include "clientHead.h"

// 参数 ip port 返回值sockfd
int tcpInit(char *ip, char *port){
    // socket --> connect
    int sockfd = socket(AF_INET, SOCK_STREAM, 0);
    struct sockaddr_in addr;
    addr.sin_family = AF_INET;
    addr.sin_port = htons(atoi(port));
    addr.sin_addr.s_addr = inet_addr(ip);
    int ret = connect(sockfd, (struct sockaddr *)&addr, sizeof(addr));
    ERROR_CHECK(ret, -1, "client connect");
    return sockfd;
}
